package com.itheima.exception;

import com.itheima.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
 * @Author: fan
 * @Desc: 全局异常处理器
 * @Date: 2022/6/7 17:26
 */
@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler(BusinessException.class)
    public Result handlerProjectEx(BusinessException e) {
        return new Result(e.getCode(), e.getMessage());
    }

    @ExceptionHandler(SystemException.class)
    public Result handlerProjectEx1(SystemException e) {
        return new Result(e.getCode(), e.getMessage());
    }
}